<template>
    <div class="register-container">
         <register @func="register"></register>
    </div>
</template>

<script>
    import register from '../subcomponents/register.vue'
    import {Toast} from 'mint-ui'
    export default {
        components:{
            register
        },
        methods:{
            register(option){
                if(option.password1 == option.password2){
                    this.$http.post('http://127.0.0.1:3002/addUser',option,{emulateJSON:true}).then((result)=>{
                        if(result.body.status == 0){
                            //alert('123')
                            Toast('注册成功');
                            this.$router.push('/user');
                        }

                    });
                }else{
                    Toast('密码不一致');
                }
            }
        }
    }
</script>

<style scoped>

</style>